<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>学生成绩查询</title>
<meta name="description" content="">
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="stylesheet" href="${s.base}/phone/css/common.css">
<link rel="stylesheet" href="${s.base}/phone/css/font-awesome.css">
<link rel="stylesheet" href="${s.base}/phone/css/layui.css" />
</head>
<body>
	<input type="hidden" id="id" value="${id}" />
	<input type="hidden" id="personType" value="${personType}" />
	<input type="hidden" id="studentName" value="${msgStudent.studentName}" />

	<input type="hidden" id="pageSize" value="8" />
	<input type="hidden" id="pageNum" value="1" />

	<div class="course-content" id="LAY_demo1">

	</div>

<script src="${s.base}/js/jquery-3.2.0.min.js"></script>
<script  type="application/javascript" src="${s.base}/js/layer/layer.js" ></script>
<script  type="application/javascript" src="${s.base}/js/layer/commont.js" ></script>
<script src="${s.base}/phone/js/lay/layui.js" charset="utf-8"></script>
<script>
    layui.use('flow', function(){
        var flow = layui.flow;
        flow.load({
            elem: '#LAY_demo1' //流加载容器
            ,scrollElem: '#LAY_demo1' //滚动条所在元素，一般不用填，此处只是演示需要。
            ,done: function(page, next){ //执行下一页的回调

                var lis = [];
                var url="${s.base}/mobile/acceptStudentScore";
                var params = {
                    personType: $("#personType").val(),
                    id: $("#id").val(),
                    pageSize: $("#pageSize").val(),
                    pageNum: page
                };
                $.ajax({
                    url : url,
                    type : 'POST',
                    dataType : 'json',
                    data:params,
                    //contentType : 'application/json',
                    success : function(data, status, xhr) {
                        if(data.returnInfo.state==1){
                            var pageNum=data.returnInfo.result.pageNum;
                            var pageSize=data.returnInfo.result.pageSize;
                            var isLastPage=data.returnInfo.result.isLastPage;
                            var list=data.returnInfo.result.resultList;
                            //模拟插入
                            setTimeout(function(){
                                var lis = [];
                                if(list!=null && list.length >0){
                                    for(var i=0;i<list.length;i++){
                                        var obj=list[i];
                                        var replyC="";
                                        //alert(obj.acceptId+";"+$("#id").val());
                                        var c='<div class="score-list">'+
                                            '<h3>'+obj.title+'</h3>'+
                                            '<p><span>姓名：'+$("#studentName").val()+'</span></p>'+
                                            '<p><span>总分：'+obj.sum+'</span></p>'+
                                            '<p><span>时间：'+new Date(obj.createTime).toLocaleDateString()+'</span></p>'+
                                            '<a href="${s.base}/mobile/scoreDetails?examId='+obj.examId+'&id='+$("#id").val()+'&personType='+$("#personType").val()+'" >查看详情</a>'+
                                            '</div>';
                                        lis.push(c);
                                    }
                                }
                                next(lis.join(''), !isLastPage); //假设总页数为 6
                            }, 500);

                        }else {
                            offset("auto",data.returnEntity.errorMsg,"提示","确定");
                        }
                    },
                    Error : function(xhr, error, exception) {
                        offset("auto",exception.toString(),"提示","确定");
                    }
                });
                //执行下一页渲染，第二参数为：满足“加载更多”的条件，即后面仍有分页
                //pages为Ajax返回的总页数，只有当前页小于总页数的情况下，才会继续出现加载更多
                next(lis.join(''), page<10);

            }
        });
    });
</script>
</body>
</html>

